Visual Basic (Declaration) | |
---|---|
Public ReadOnly Property SetterInterceptor As PropertyInterceptor(Of TInstance,TValue,NavigationEntityPropertySetInterceptorArgs(Of TInstance,TValue)) |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As NavigationScalarEntityProperty(Of TInstance,TValue) Dim value As PropertyInterceptor(Of TInstance,TValue,NavigationEntityPropertySetInterceptorArgs(Of TInstance,TValue)) value = instance.SetterInterceptor |
C# | |
---|---|
public PropertyInterceptor<TInstance,TValue,NavigationEntityPropertySetInterceptorArgs<TInstance,TValue>> SetterInterceptor {get;} |
C++/CLI | |
---|---|
public: property PropertyInterceptor<TInstance^,TValue^,NavigationEntityPropertySetInterceptorArgs<TInstance^,TValue^>^>^ SetterInterceptor { PropertyInterceptor<TInstance^,TValue^,NavigationEntityPropertySetInterceptorArgs<TInstance^,TValue^>^>^ get(); } |
C# | ![]() |
---|---|
public void Sample() { // Add a BeforeGet action to a GetterInterceptor: Employee.PropertyMetadata.DirectReports.GetterInterceptor.AddAction( PropertyInterceptorTiming.Before, TraceGetter); // Add a BeforeSet action to a SetterInterceptor (a SetterInterceptor is available // only for scalar and non-readonly navigation properties). Employee.PropertyMetadata..Manager.SetterInterceptor.AddAction( PropertyInterceptorTiming.Before, TraceSetter); // Get/set a few properties DomainModelEntityManager mgr = new DomainModelEntityManager(); Employee e = mgr.Employees.First(); e.Manager = null; var list = e.DirectReports; } public static void TraceGetter(IEntityPropertyGetInterceptorArgs args) { Console.WriteLine("getter called for " + args.EntityProperty.Name); } public static void TraceSetter(IEntityPropertySetInterceptorArgs args) { Console.WriteLine("setter called for " + args.EntityProperty.Name); } |
Use the SetterInterceptor to add custom BeforeSet and AfterSet interception actions to a property setter.
Any registered IdeaBlade.Validation.VerifierExecutionModes.OnBeforeSetTriggers and IdeaBlade.Validation.VerifierExecutionModes.OnAfterSetTriggers verifiers will be executed This verification is done immediately before and after the value is stored in the backing field. BeforeSet actions will occur before OnBeforeSet verification and AfterSet actions will occur after OnAfterSet verification.
Will be null for a read only property.
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family